    $(function (){
        //头部数据加载
        loadHeadDate();
        //页面推荐1
        loadRecommend1();
        //页面推荐2
        loadRecommend2();
    })


    var cxt = "/knowledge/";

    //头部数据加载
    function loadHeadDate(){
        $.ajax({
            type: "POST",
            dataType: "JSON",
            url: cxt+"welcomepage/selectHeadDate",
            contentType: "application/json;charset=UTF-8",
            success: function(result){
                if(result!=null){
                    $("#read01").html(result.read01);
                    $("#read02").html(result.read02);
                    $("#read03").html(result.read03);
                    $("#read04").html(result.read04);
                    $("#read05").html(result.read05);
                    $("#read06").html(fileSuffixNameDistinguish(result.read06));
                    $("#read07").html(result.read07);
                    $("#read08").html(fileSuffixNameDistinguish(result.read08));
                    $("#read09").html(result.read09);
                    $("#read10").html(result.read10);
                    $("#read11").html(result.read11);
                    $("#read12").html(parseFloat(result.read12)*100+"%");
                }
            },
            error: function(result){

            }
        })
    }

    //页面推荐1
    function loadRecommend1(){
        var echart = echarts.init(document.getElementById("ymtj1"));
        var dataLegend = ['待审核','审核通过','审核未通过'];
        var data = ['0','0','0'];
        $.ajax({
            type: "POST",
            dataType: "JSON",
            async:  false,
            url: cxt+"welcomepage/selectRecommend1",
            contentType: "application/json;charset=UTF-8",
            success: function(result){
                if(result!=null){
                    data[0] =result.read01;
                    data[1] =result.read02;
                    data[2] =result.read03;
                }
            },
            error: function(result){
            }
        })
        option = {
            tooltip : {
                trigger: 'item',
                formatter: "{b}：{c} <br/> 占比：{d}%"
            },
            legend: {
                orient: 'vertical',
                left: 'left',
                top: 'center',
                data: dataLegend
            },
            series : [
                {
                    type: 'pie',
                    radius : '55%',
                    center: ['60%', '50%'],
                    data:[
                        {value:data[0], name:dataLegend[0]},
                        {value:data[1], name:dataLegend[1]},
                        {value:data[2], name:dataLegend[2]}
                    ],
                    itemStyle: {
                        emphasis: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        };
        echart.setOption(option);
        echart.hideLoading();
        //自动适应屏幕浏览器的大小 当浏览器大小改变时 报表画布也跟着改变
        window.onresize = function () {
            echart.resize();
        };
    }

    //页面推荐2
    function loadRecommend2(){
        var echart = echarts.init(document.getElementById("ymtj2"));
        var dataLegend = ['word','excel','ppt','pdf','其他类型'];
        var data = ['0','0','0','0','0'];
        $.ajax({
            type: "POST",
            dataType: "JSON",
            async:  false,
            url: cxt+"welcomepage/selectRecommend2",
            contentType: "application/json;charset=UTF-8",
            success: function(result){
                if(result!=null){
                    data[0] =result.read01;
                    data[1] =result.read02;
                    data[2] =result.read03;
                    data[3] =result.read04;
                    data[4] =result.read05;
                }
            },
            error: function(result){
            }
        })
        option = {
            tooltip : {
                trigger: 'item',
                formatter: "{b}：{c} <br/> 占比：{d}%"
            },
            legend: {
                orient: 'vertical',
                left: 'right',
                top: 'center',
                data: dataLegend
            },
            series : [
                {
                    type: 'pie',
                    radius : '55%',
                    center: ['40%', '50%'],
                    data:[
                        {value:data[0], name:dataLegend[0]},
                        {value:data[1], name:dataLegend[1]},
                        {value:data[2], name:dataLegend[2]},
                        {value:data[3], name:dataLegend[3]},
                        {value:data[4], name:dataLegend[4]}
                    ],
                    itemStyle: {
                        emphasis: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        };
        echart.setOption(option);
        echart.hideLoading();
        //自动适应屏幕浏览器的大小 当浏览器大小改变时 报表画布也跟着改变
        window.onresize = function () {
            echart.resize();
        };
    }

    //文档后缀名自动识别方法
    function fileSuffixNameDistinguish(suffixName){
        if(suffixName==null||suffixName==""){
            return "";
        }else{
            var returnName = "";
            if(suffixName=="doc"||suffixName=="docx"){
                returnName = "word";
            }else if(suffixName=="xls"||suffixName=="xlsx"){
                returnName = "excel";
            }else if(suffixName=="ppt"||suffixName=="pptx"){
                returnName = "ppt";
            }else if(suffixName=="pdf"){
                returnName = "pdf";
            }else{
                returnName = "其它";
            }
            return returnName;
        }
    }

